<%-- 
    Document   : billdetails
    Created on : 21-Jul-2013, 22:09:35
    Author     : Minh Quyen
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"/>
        <title>Bill Detail Page</title>
        <link rel="shortcut icon" href="./images2/logo.jpg">
    </head>
    <body style="background-image: url('images2/staff.jpg')">
        <div align="center">
            <h1 class="text-success"><font face="Algerian">Bill Details</font> </h1>
            <hr>
            <form action="Staff" method="POST">
                <table>
                    <tr>
                        <td align="right">Username:</td>
                        <td align="left"><input type="text" value="${CUS.username}" readonly="readonly" name="txtUsername"/> </td>
                    </tr>
                    <tr>
                        <td align="right">Date:</td>
                        <td align="left"><input type="text" value="${DATE}" readonly="readonly" /> </td>
                    </tr>
                    <tr>
                        <td align="right">Point:</td>
                        <c:set var="cPoint" value="${CUS.point + BILL.point}"/>
                        <td align="left"><input type="text" value="${CUS.point}" readonly="readonly"/> </td>
                        <td align="right">New point:</td>
                        <td align="left"><input type="text" name="txtPoint" value="${cPoint}" readonly="readonly"/> </td>
                    </tr>
                    <tr>
                        <td align="right">Card type:</td>
                        <td align="left"><input type="text" value="${CUS.rank}" readonly="readonly"/> </td>
                        <td align="right">New Card type:</td>
                        <td align="left">
                            <c:if test="${cPoint lt 50000}">
                                <input type="text" name="txtRank" value="Regular" readonly="readonly"/>
                            </c:if>
                            <c:if test="${cPoint ge 50000}">
                                <c:if test="${cPoint lt 100000}">
                                    <input type="text" name="txtRank" value="Silver" readonly="readonly"/>
                                </c:if>
                            </c:if>
                            <c:if test="${cPoint ge 100000}">
                                <input type="text" name="txtRank" value="Gold" readonly="readonly"/>
                            </c:if>
                        </td>
                    </tr>
                </table>
                <hr>
                <h2 align="center" class="text-warning"><font face="Algerian">PRODUCTS</font></h2>
                <c:if test="${not empty BILL}">
                    <table class="table table-hover">
                        <tr class="info">
                            <th></th>
                            <th align="center">No.</th>
                            <th align="center">Product</th>
                            <th align="center">Quantity</th>
                            <th align="center">Unit Price</th>
                            <th align="center">Total</th>
                        </tr>
                        <c:forEach var="item" items="${BILLITEM}" varStatus="counter">
                            <tr class="info">
                                <td>
                                    <button type="submit" class="btn btn-inverse" name="btAction" value="DeletePro">X</button>
                                </td>
                                <td>${counter.count}</td>
                                <td>
                                    ${item.product.productId} - ${item.product.productName}
                                    <input type="hidden" name="txtProduct" value="${item.product.productId}" />
                                </td>
                                <td>${item.quantity}</td>
                                <td>${item.unitPrice}</td>
                                <td>${item.unitPrice * item.quantity}</td>
                            </tr>
                        </c:forEach>
                        <tr>
                            <td></td>
                            <td>Room:</td>
                            <td>${BILL.room.roomId} - ${BILL.room.roomName}</td>
                            <td></td>
                            <td>${BILL.roomPrice}$</td>
                            <td>${BILL.roomPrice}$</td>
                        </tr>
                        <tr>
                            <td colspan="4"></td>
                            <td>Payment:</td>
                            <td>${BILL.payment}$</td>
                        </tr>
                        <tr>
                            <td colspan="4"></td>
                            <td>Point:</td>
                            <td>${BILL.point}</td>
                        </tr>
                    </table>
                </c:if>
                <div align="center">
                    <input type="submit" class="btn btn-inverse" value="Add more" name="btAction" />
                    <input type="submit" class="btn btn-inverse" value="Print Bill" name="btAction" />
                </div>
            </form>
        </div>
    </body>
</html>
